package com.my.mapper;

import com.my.vo.UserVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from tb_user where userId=#{userId}")
    @Results(
            @Result(column = "departId" ,property = "department",
            one = @One(select = "com.my.mapper.DepartmentMapper.getDepartmentById"))
    )
    UserVo getUserById(Integer userId);

    @Select("select * from tb_user")
    @Results(
            @Result(column = "departId" ,property = "department",
            one = @One(select = "com.my.mapper.DepartmentMapper.getDepartmentById"))
    )
    List<UserVo> getAllUser();
}
